local biz_name = "luasts"

local function _luasts_biz()
    return coroutine.create(function ()
        local coroutine_yield = coroutine.yield
        local reply_ok = reply.status_type.ok
        local reply_setStatus = reply.setStatus
        local reply_appendContent = reply.appendContent
        local get_count = util.log_get_business_count
        local get_log_time = util.log_get_log_time
        while true do
            reply_appendContent("<html><head><title>Lua_Status</title></head><body>");
            reply_appendContent("<h3>")
            reply_appendContent("Received zc.1: "..get_count("received_zc.1"))
            reply_appendContent("</h3>")
            reply_appendContent("<h3>")
            reply_appendContent("Number of redis-pushed zc_1: "..get_count("processed_zc1"))
            reply_appendContent("</h3>")	
            reply_appendContent("<h3>")
            reply_appendContent("Number of redis-pushed zc_1: "..get_count("zc.1"))
            reply_appendContent("</h3>")	
            reply_appendContent("<h3>")
            reply_appendContent("Ratio of received zc1 to redis-pushed zc_1: "..(get_count("processed_zc1")/get_count("zc.1")))
            reply_appendContent("</h3>")
            reply_appendContent("<h3>")
            reply_appendContent("Number of redis-pushed zc_2: "..get_count("zc.2"))
            reply_appendContent("</h3>")	
            
            reply_appendContent("<h3>")
            reply_appendContent("Number of redis-pushed adv: "..get_count("adv"))
            reply_appendContent("</h3>")	
            
			reply_appendContent("<h3>")
            reply_appendContent("logged time: "..get_log_time())
            reply_appendContent("</h3>")	

            reply_appendContent("</body></html>")
            reply_setStatus(reply_ok)
            coroutine_yield()
        end
    end)
end

creators[biz_name] = function()
    f[biz_name] =  _luasts_biz()
end
